Fix tooltip triggering
authorMatthias Clasen <mclasen@redhat.com>
Sun, 15 Nov 2020 14:34:25 +0000 (09:34 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 15 Nov 2020 15:54:36 +0000 (10:54 -0500)
Ever since 5b5d2665d373c35f, tooltips don't work properly,
since we get more motion events now, and those keep the
tooltips from appearing. This can be seen e.g. on the icon
in the password entry in widget-factory, or on the section
switcher buttons in the Emoji chooser.

Ignore synthetic motion events for the purposes of
determining whether the user moved the mouse.

gtk/gtktooltip.c

index 73c54cd6b08da407807d3a01e842a88663b2e217..392bd0620efa46c1966221a8e81e31884bf83896 100644 (file)
@@ -917,6 +917,11 @@ _gtk_tooltip_handle_event (GtkWidget *target,
   surface = gdk_event_get_surface (event);
   gdk_event_get_position (event, &x, &y);
 
+  /* ignore synthetic motion events */
+  if (event_type == GDK_MOTION_NOTIFY &&
+      gdk_event_get_time (event) == GDK_CURRENT_TIME)
+    return;
+
   gtk_native_get_surface_transform (native, &nx, &ny);
   gtk_widget_translate_coordinates (GTK_WIDGET (native), target, x - nx, y - ny, &x, &y);
   gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);